/*
** b_exit.c for minishell2 in /home/lingla_j/work/tutorat/env
** 
** Made by julien linglain
** Login   <lingla_j@epitech.net>
** 
** Started on  Sat Mar  3 13:43:23 2012 julien linglain
** Last update Thu Mar 22 15:26:23 2012 julien linglain
*/

#include <stdlib.h>
#include "mysh.h"

int		b_exit(int bc, char *s, char **bv, t_list *env)
{
  int		i;

  i = 0;
  if (bc > 0)
    {
      while (bv[i] != '\0')
	{
	  free(bv[i]);
	  i++;
	}
      free(s);
      if (env->size != 0)
	delete_list_all(env);
      exit(EXIT_SUCCESS);
    }
  else
    my_puterror("Usage: exit.\n");
  return (EXIT_SUCCESS);
}

int		free_bv(int bc, char **bv)
{
  int   i;

  i = 0;
  if (bc == 1)
    {
      while (bv[i] != '\0')
        {
          free(bv[i]);
          i++;
        }
    }
  return (EXIT_SUCCESS);
}
